function matrix_A = assemble_matrix_A_1d(node, elem, function_cor, dN, trial_type, test_type, N_gauss_int1d)

matrix_A = sparse(size(node,2), size(node,2));

for n = 1:size(elem,1)
    E = node(elem(n,:));
    a = E(1);
    b = E(2);
    phi = function_transform_1d(-1, 1, dN, a, b);
    psi = function_transform_1d(-1, 1, dN, a, b);
    if trial_type == "dx"
        phi = function_symbolic_computing_1d(phi, "dx");
    end
    if test_type == "dx"
        psi = function_symbolic_computing_1d(psi, "dx");
    end
    for alpha = 1:size(elem,2)
        for beta = 1:size(elem,2)
            f = @(xi) function_cor(xi).*phi{alpha}(xi).*psi{beta}(xi);
            r = gauss_int1d(f, a, b , N_gauss_int1d);
            i = elem(n,beta);
            j = elem(n,alpha);
            matrix_A(i,j) = matrix_A(i,j) + r;
        end
    end
end

end